package com.example.testdemo.kstatic.sprite.terrain;

import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

import com.example.testdemo.kstatic.data.DataOfWall;
import com.example.testdemo.kstatic.sprite.ItemSprite;
import com.example.testdemo.kstatic.sprite.TerrainSprite;


public class WallTerrain extends TerrainSprite {
	
	public DataOfWall mData = null;
	private ItemSprite mItem;

	public WallTerrain(float pX, float pY, ITextureRegion pTextureRegion,
	        VertexBufferObjectManager pVertexBufferObjectManager) {
		super(pX, pY, pTextureRegion, pVertexBufferObjectManager);
		mData = new DataOfWall(DataOfWall.DEFENCE_1);
	}

	public void setItemSprite(ItemSprite item) {
		mItem = item;
		mItem.setPosition(getX(), getY());
	}

	@Override
	public void setVisible(boolean pVisible) {
		super.setVisible(pVisible);
		if (!pVisible && mItem != null) {
			mItem.setVisible(true);
		}
	}

}
